import Vue from 'vue';
import App from './App.vue';
import router from '@router';
import store from '@store';
import Vant from 'vant';
import 'vant/lib/index.less';
import { serializeToUrl } from '@utils/index.js';
import { xx } from '@scripts/block';
import '@scripts/index';
import '@config/index';
import '@components/render.js'
import axios from 'axios';
//import mqttClient from '../server.js';
import TreeTable from 'tree-table-vue';
Vue.use(Vant);
Vue.use(TreeTable);
Vue.prototype.serializeToUrl = serializeToUrl;
Vue.prototype.xx = xx;
Vue.prototype.$axios = axios;
//Vue.prototype.$mqttClient = mqttClient;
Vue.config.productionTip = false;
window.addEventListener('load', function() {
  window.$utils.hideToolbar();
});
// router.afterEach((from, to) => {
//   //console.log(from, to);
// });
// 创建 Profile 实例，并挂载到一个元素上。
// Vue.directive('trang', function(el, binding, vnode) {
//   console.log('i m miss trang',el, binding,vnode);
// });
Vue.extend({
  testing: '<p>{{firstName}} {{lastName}} aka {{alias}}</p>'
});
Vue.filter('quyen', (value)=>{
  return value+' is pig';
})
new Vue({
  router,
  store,
  created() {
    var _this = this;
    _this.$store.dispatch('general/login').then(() => {
      _this.$router.replace('/processor/index');
    });
  },
  render: (h) => h(App)
}).$mount('#app');
